home *** CD-ROM | disk | FTP | other *** search
/ Windows Game Programming for Dummies (2nd Edition) / WinGamProgFD.iso / mac / DirectX SDK / DXSDK / samples / Multimedia / DirectShow_WinXP / VMR / Renderless / app.h < prev    next >
C/C++ Source or Header  |  2001-10-08  |  6KB  |  300 lines

  1. //------------------------------------------------------------------------------
  2. // File: app.h
  3. //
  4. // Desc: DirectShow sample code - prototypes for the Renderless player
  5. //
  6. // Copyright (c) 1994 - 2001, Microsoft Corporation.  All rights reserved.
  7. //------------------------------------------------------------------------------
  8.  
  9. /* -------------------------------------------------------------------------
  10. ** Function prototypes
  11. ** -------------------------------------------------------------------------
  12. */
  13. int DoMainLoop(void);
  14. BOOL InitApplication(HINSTANCE hInstance);
  15. BOOL InitInstance(HINSTANCE hInstance,int nCmdShow);
  16.  
  17. void UpdateMpegMovieRect(void);
  18. void GetAdjustedClientRect(RECT *prc);
  19.  
  20. BOOL DrawStats(HDC hdc);
  21. void CalcMovieRect(LPRECT lprc);
  22.  
  23. LPCTSTR IdStr(int idResource);
  24. void UpdateSystemColors(void);
  25.  
  26.  
  27. /* -------------------------------------------------------------------------
  28. ** Message crackers
  29. ** -------------------------------------------------------------------------
  30. */
  31. /* void Cls_OnUser(HWND hwnd, WPARAM wParam, LPARAM lParam ) */
  32. #define HANDLE_WM_USER(hwnd, wParam, lParam, fn) \
  33.     ((fn)(hwnd, wParam, lParam), 0L)
  34.  
  35. #ifndef HANDLE_WM_NOTIFY
  36. /* LRESULT Cls_OnNotify(HWND hwnd, int idFrom, NMHDR FAR* pnmhdr); */
  37. #define HANDLE_WM_NOTIFY(hwnd, wParam, lParam, fn) \
  38.     (fn)((hwnd), (int)(wParam), (NMHDR FAR*)(lParam))
  39. #endif
  40.  
  41.  
  42. /* -------------------------------------------------------------------------
  43. ** VideoCd window class prototypes
  44. ** -------------------------------------------------------------------------
  45. */
  46. extern "C" LRESULT CALLBACK
  47. VideoCdWndProc(
  48.     HWND hwnd,
  49.     UINT message,
  50.     WPARAM wParam,
  51.     LPARAM lParam
  52.     );
  53.  
  54. void
  55. VideoCd_OnClose(
  56.     HWND hwnd
  57.     );
  58.  
  59. BOOL
  60. VideoCd_OnQueryEndSession(
  61.     HWND hwnd
  62.     );
  63.  
  64. void
  65. VideoCd_OnDestroy(
  66.     HWND hwnd
  67.     );
  68.  
  69. void
  70. VideoCd_OnCommand(
  71.     HWND hwnd,
  72.     int id,
  73.     HWND hwndCtl,
  74.     UINT codeNotify
  75.     );
  76.  
  77. void
  78. VideoCd_OnPaint(
  79.     HWND hwnd
  80.     );
  81.  
  82. void
  83. VideoCd_OnTimer(
  84.     HWND hwnd,
  85.     UINT id
  86.     );
  87.  
  88. BOOL
  89. VideoCd_OnCreate(
  90.     HWND hwnd,
  91.     LPCREATESTRUCT lpCreateStruct
  92.     );
  93.  
  94. void
  95. VideoCd_OnSize(
  96.     HWND hwnd,
  97.     UINT state,
  98.     int cx,
  99.     int cy
  100.     );
  101.  
  102. void
  103. VideoCd_OnKeyUp(
  104.     HWND hwnd,
  105.     UINT vk,
  106.     BOOL fDown,
  107.     int cRepeat,
  108.     UINT flags
  109.     );
  110.  
  111. void
  112. VideoCd_OnHScroll(
  113.     HWND hwnd,
  114.     HWND hwndCtl,
  115.     UINT code,
  116.     int pos
  117.     );
  118.  
  119. void
  120. VideoCd_OnUser(
  121.     HWND hwnd,
  122.     WPARAM wParam,
  123.     LPARAM lParam
  124.     );
  125.  
  126. void
  127. VideoCd_OnSysColorChange(
  128.     HWND hwnd
  129.     );
  130.  
  131. void
  132. VideoCd_OnMenuSelect(
  133.     HWND hwnd,
  134.     HMENU hmenu,
  135.     int item,
  136.     HMENU hmenuPopup,
  137.     UINT flags
  138.     );
  139.  
  140. void
  141. VideoCd_OnInitMenuPopup(
  142.     HWND hwnd,
  143.     HMENU hMenu,
  144.     UINT item,
  145.     BOOL fSystemMenu
  146.     );
  147.  
  148. #ifdef WM_NOTIFY
  149. LRESULT
  150. VideoCd_OnNotify(
  151.     HWND hwnd,
  152.     int idFrom,
  153.     NMHDR FAR* pnmhdr
  154.     );
  155. #endif
  156.  
  157. void
  158. VideoCd_OnGraphNotify(
  159.     int stream
  160.     );
  161.  
  162. void
  163. VideoCd_OnDropFiles(
  164.     HWND hwnd,
  165.     HDROP hdrop);
  166.  
  167. void
  168. SetPlayButtonsEnableState(
  169.     void
  170.     );
  171.  
  172.  
  173. /* -------------------------------------------------------------------------
  174. ** Command processing functions
  175. ** -------------------------------------------------------------------------
  176. */
  177.  
  178. BOOL
  179. VcdPlayerSetLog(
  180.     void
  181.     );
  182.  
  183. BOOL
  184. VcdPlayerSetPerfLogFile(
  185.     void
  186.     );
  187.  
  188. BOOL
  189. VcdPlayerOpenCmd(
  190.     void
  191.     );
  192.  
  193. BOOL
  194. VcdPlayerCloseCmd(
  195.     void
  196.     );
  197.  
  198. BOOL
  199. VcdPlayerPlayCmd(
  200.     void
  201.     );
  202.  
  203. BOOL
  204. VcdPlayerStopCmd(
  205.     void
  206.     );
  207.  
  208. BOOL
  209. VcdPlayerPauseCmd(
  210.     void
  211.     );
  212.  
  213. BOOL
  214. VcdPlayerPauseCmd(
  215.     void
  216.     );
  217.  
  218. BOOL
  219. VcdPlayerRewindCmd(
  220.     void
  221.     );
  222.  
  223. void
  224. VcdPlayerSeekCmd(
  225.     REFTIME rtSeekBy
  226.     );
  227.  
  228. void
  229. ProcessOpen(
  230.     TCHAR *achFileName,
  231.     BOOL bPlay = FALSE
  232.     );
  233.  
  234. /* -------------------------------------------------------------------------
  235. ** Recent filename defines
  236. ** -------------------------------------------------------------------------
  237. */
  238. typedef TCHAR RECENTFILES[MAX_PATH];
  239. #define MAX_RECENT_FILES    5
  240. #define ID_RECENT_FILE_BASE 500
  241.  
  242. int
  243. GetRecentFiles(
  244.     int LastCount
  245.     );
  246.  
  247. int
  248. SetRecentFiles(
  249.     TCHAR *FileName,
  250.     int iCount
  251.     );
  252.  
  253. /* -------------------------------------------------------------------------
  254. ** Global Variables
  255. ** -------------------------------------------------------------------------
  256. */
  257. extern int              cxMovie;
  258. extern int              cyMovie;
  259. extern HWND             hwndApp;
  260.  
  261. extern int              cx;
  262. extern int              cy;
  263. extern int              xOffset;
  264. extern int              yOffset;
  265. extern DWORD            g_State;
  266. extern TCHAR            g_szPerfLog[];
  267. extern int              g_TimeFormat;
  268.  
  269. /* -------------------------------------------------------------------------
  270. ** Constants
  271. ** -------------------------------------------------------------------------
  272. */
  273. #define LEFT_MARGIN 0
  274.  
  275. /* -------------------------------------------------------------------------
  276. ** Video CD Player states
  277. **
  278. **  These are bit flags
  279. ** -------------------------------------------------------------------------
  280. */
  281.  
  282. #define VCD_PLAYING          0x0001
  283. #define VCD_STOPPED          0x0002
  284. #define VCD_PAUSED           0x0004
  285. #define VCD_SKIP_F           0x0008
  286. #define VCD_SKIP_B           0x0010
  287. #define VCD_FF               0x0020
  288. #define VCD_RW               0x0040
  289. #define VCD_SEEKING          (VCD_FF | VCD_RW)
  290. #define VCD_LOADED           0x0080
  291. #define VCD_NO_CD            0x0100
  292. #define VCD_DATA_CD_LOADED   0x0200
  293. #define VCD_EDITING          0x0400
  294. #define VCD_PAUSED_AND_MOVED 0x0800
  295. #define VCD_PLAY_PENDING     0x1000
  296. #define VCD_WAS_PLAYING      0x2000
  297. #define VCD_IN_USE           0x4000
  298.  
  299. enum {PerformanceTimer = 32, StatusTimer = 33};
  300.